home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * Elmt first put into list gets killed when 2nd elmt is added.
- * This shows both visually and in XmStringCompare
- */
-
- #include <Xm/List.h>
-
- int
- main(argc, argv)
- int argc;
- char **argv;
- {
- Widget list;
- XtAppContext app;
- Widget toplevel;
- XmString str1, str2;
- Arg args[10];
- int n = 0;
- XmString *items;
-
- toplevel = XtAppInitialize(&app, "XmSend", NULL, 0, &argc, argv,
- NULL, NULL, 0);
-
-
- XtSetArg(args[n], XmNvisibleItemCount, 3); n++;
- list = XmCreateList(toplevel, "top_list", args, n);
- XtManageChild(list);
-
- str1 = XmStringCreateLocalized("fred");
- str2 = XmStringCreateLocalized("bill");
-
- XmListAddItem(list, str1, 1);
- XmListAddItem(list, str2, 1);
-
- XtVaGetValues(list, XmNitems, &items, NULL);
- if (XmStringCompare(str2, items[0]))
- printf("1st item same\n");
- else
- printf("1st item differs\n");
- if (XmStringCompare(str1, items[1]))
- printf("2nd item same\n");
- else
- printf("2nd item differs\n");
-
- XtRealizeWidget(toplevel);
-
- XtAppMainLoop(app);
- }
-